﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Order_Generate_json.aspx.cs" Inherits="newBlog.CenterInc.view_json.admin.Order_Generate_json" %>
<%@ Import Namespace="newBlog.CenterInc.model" %>
<%@ Import Namespace="newBlog.CenterInc.Ctrltor" %>
<%@ Import Namespace="System.Web.Script.Serialization" %>
<% 
    Response.ContentType = "application/json";
    if (Session["user_id"]==null) {
        Response.Write("{\"error\":\"您未登录本站\"}");
        return;
    }
    if (Convert.ToInt32(Session["user_grade"])!=1) { 
    Response.Write("{\"error\":\"您不是管理员\"}");
        return;
    }
    int mode = (Request.Form["mode"] == null || Request.Form["mode"].Length == 0) ? 0 : Convert.ToInt32(Request.Form["mode"]);//默认全部显示 1未使用 2使用
    int page = (Request.Form["page"] == null || Request.Form["page"].Length == 0) ? 0 : Convert.ToInt32(Request.Form["page"])>0?Convert.ToInt32(Request.Form["page"])-1:0;
    Pay_inc pay_Inc = new Pay_inc();
    int count = pay_Inc.carmichaelsCount(mode);
    JavaScriptSerializer serializer = new JavaScriptSerializer();
    List<CarmichaelDao> list = pay_Inc.carmichaels(mode,page);
    string json = "{\"code\":0,\"msg\":\"\",\"count\":"+count+",\"data\":"+serializer.Serialize(list)+"}";
    Response.Write(json);
    %>